<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scaleable=no" />
  <meta http-equiv="X-UA-Compatible" content="ie=edge" />
  <title>修改密码</title>
  <link rel="stylesheet" href="../../lib/layui/css/layui.css" />
  <style>
    body {
      padding-right: 20px;
      padding-top: 20px;
      background-color: #fff;
    }
    .layui-input:focus, .layui-textarea:focus {
      border-color: rgb(240, 97, 47)!important;
    }
    .layui-form-label {
      width: 150px;
    }
    .submit-btn {
      background-color: rgb(240, 97, 47)!important;
    }
  </style>
</head>

<body>
  <form class="layui-form" action="">
    <div class="layui-form-item">
      <label class="layui-form-label">请输入原始密码：</label>
      <div class="layui-inline " style="float: left;">
        <input type="password" name="originPwd" required lay-verify="required|space|zh|symbol|length_6_30" placeholder="" autocomplete="off" class="layui-input" autofocus/>
      </div>
      <label class="layui-form-label" style="width: auto;">忘记密码？请使用<a href="./forgetPwd.html">手机动态码校验</a></label>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label"></label>
      <div class="layui-inline " style="float: left; color: rgb(240, 97, 47);">
        原始密码不正确，请重新输入！
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">请输入新密码：</label>
      <div class="layui-inline">
        <input type="password" name="newPwd" required lay-verify="required|space|zh|symbol|length_6_30" placeholder="" autocomplete="off" class="layui-input" />
      </div>
    </div>
    <div class="layui-form-item">
      <label class="layui-form-label">请验证新密码：</label>
      <div class="layui-inline">
        <input type="password" name="newPwd2" required lay-verify="required|space|zh|symbol|length_6_30" placeholder="" autocomplete="off" class="layui-input" />
      </div>
    </div>
    </div>
    <div class="layui-form-item">
      <div class="layui-input-block" style="margin-left: 180px;">
        <button class="submit-btn layui-btn" lay-submit lay-filter="formDemo">
          确定修改
        </button>
      </div>
    </div>
  </form>
  <script src="../../lib/layui/layui.js"></script>
  <script src="../../scripts/custom-verify.js"></script>
  <script>

    layui.use(["form", "element", "jquery"], function () {
      var form = layui.form;
      var element = layui.element;
      var $ = layui.jquery;

      form.verify(getCustomVerifyObj());

      //监听表单信息提交
      form.on("submit(formDemo)", function (data) {
        console.log("表单数据如下：");
        console.log(data.field); //当前容器的全部表单字段，名值对形式：{name: value}
        if (data.field.newPwd === data.field.newPwd2) {
          layer.msg("打开开发者控制台查看保存信息");

        } else {
          layer.msg("两次输入新密码不一致", {icon: 5});

        }
        return false; // 阻止表单跳转
      });
    })
  </script>
</body>

</html>